package lang;

import lang.asm.ASM;
import model.symbol.Scope;
import model.code.line.Line;
import model.code.line.MultiLineList;

/**
 * This is the superclass of all supported languages.
 *
 * @author Neil Dickson
 */
public abstract class Language {
	public abstract Loader getLoader();
	public abstract Saver getSaver();
	public abstract DocParser getDocParser();
	public abstract Parser getParser();
	public abstract ErrorDetector getErrorDetector();
	public abstract Encoder getEncoder();
	public abstract String getName();
	public abstract String getDefaultExtension();
	public abstract String getDefaultIncludeExtension();
	public abstract Line createCodeLine(MultiLineList list, int index, char[] text);

	protected Scope					scope;

	protected Language() {
		scope = new Scope(Scope.TYPE_LANGUAGE);
	}

	public Scope getScope() {
		return scope;
	}

	public static void loadLanguages() {
		// TODO: Have a real language loading mechanism for dynamic language loading.
		// For now, just call the 6 main getters in ASM to load all of the supporting classes
		ASM.language.getLoader();
		ASM.language.getSaver();
		ASM.language.getDocParser();
		ASM.language.getParser();
		ASM.language.getErrorDetector();
		ASM.language.getEncoder();
	}
}
